//
//  CJDivColllectionVIewCell.m
//  CoJellyCartoon
//
//  Created by dllo on 16/4/1.
//  Copyright © 2016年 CJG. All rights reserved.
//

#import "CJDivColllectionVIewCell.h"

@implementation CJDivColllectionVIewCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        self.divPicture = [[UIImageView alloc] initWithFrame:CGRectZero];
        [self.contentView addSubview:self.divPicture];
        self.divname = [[CJBaseLabel alloc] initWithFrame:CGRectZero];
        self.divname.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:self.divname];
    }
    return self;
}

-(void)layoutSubviews{
    [super layoutSubviews];
    self.divPicture.frame = CGRectMake(0, 0, self.contentView.bounds.size.width, self.contentView.bounds.size.width);
    self.divname.frame = CGRectMake(0, self.divPicture.frame.origin.y+self.divPicture.frame.size.height+3, self.contentView.bounds.size.width,40);
//    [self.divPicture mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerX.equalTo(self.mas_centerX);
//        make.top.equalTo(self.mas_top).offset(5);
//        make.left.equalTo(self.mas_left).offset(5);
//        make.right.equalTo(self.mas_right).offset(-5);
//        make.bottom.equalTo(self.divname.mas_top).offset(5);
//        
//    }];
//    [self.divname mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerX.equalTo(self.mas_centerX);
//        make.top.equalTo(self.divPicture.mas_top).offset(5);
//        make.left.equalTo(self.mas_left).offset(5);
//        make.right.equalTo(self.mas_right).offset(-5);
//        make.bottom.equalTo(self.divPicture.mas_top).offset(5);
//    }];
}
-(void)setDivMainModel:(CJDivsionMainModel *)divMainModel{
    self.divPicture.image = [UIImage imageNamed:divMainModel.icon];
    self.divname.text = divMainModel.name;
    
}
@end
